package com.cloudwise.annotation;

import com.cloudwise.entity.Person;

import java.lang.annotation.Annotation;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2021/9/16 11:14
 * @description：测试注解
 * @modified By：
 * @version: 1.0
 */
public class TestAnn {
    public static void main(String[] args) {
        //通过java反射获取注解
        Class<Person> personClass = Person.class;
        Annotation[] annotations = personClass.getAnnotations();
        for (Annotation annotation : annotations) {
            MyAnnotation myann=    (MyAnnotation)annotation;
            System.out.println("注解的name值："+myann.name());
            System.out.println("注解的age值："+myann.age());
        }
    }
}
